<?php
include_once "common.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="stylesheet.css" rel="stylesheet" type="text/css" />
	<link href="<?=$hroot;?>/css/jqModal.css" rel="stylesheet" type="text/css" />
	<link href="<?=$hroot;?>/css/jquery.css" rel="stylesheet" type="text/css" />
	<link href="<?=$hroot;?>/css/style.css" rel="stylesheet" type="text/css" />
	<title>Prijsgezocht - Webshop login</title>
	<script type="text/javascript" src="/javascript/common.js" charset="iso-8859-1"></script> 
	<script type="text/javascript" src="/javascript/jquery.js" charset="iso-8859-1"></script> 
	<script type="text/javascript" src="/javascript/jquery-ui.js" charset="iso-8859-1"></script> 
	<script type="text/javascript" src="/javascript/jquery.metadata.js" charset="iso-8859-1"></script>
	<script type="text/javascript" src="/javascript/jquery.dropmenu.js" charset="iso-8859-1"></script>
	<script type="text/javascript" charset="iso-8859-1">
		$(document).ready(function() {
			$('.extraInfo').each(function(index, element){
				$(this).mouseout(function(){hideExtraTitle();}); 
				$(this).mouseover(function(){showExtraTitle(this,$(this).attr('title'));});
			});
		});
		
	</script> 
</head>
<body>
<div id="main_container">
	<div class="header">
	<?php
	if(!isset($_SESSION['login']['ID']))
	{
		?>
		<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td width="65%" rowspan="3"><img src="/images/logo_prijsgezocht2.png" width="321" height="71" align="top" /></td>
				<td width="13%">E-mailadres</td>
				<td colspan="2">Wachtwoord</td>
			</tr>
			<tr>
				<td><input type="text" name="Login" id="Login" /></td>
				<td width="12%"><input type="password" name="wachtwoord" id="wachtwoord" /> </td>
				<td width="10%"><input type="button" name="Inloggen" onclick="login();" id="Inloggen" value="Inloggen" /></td>
			</tr>
			<tr>
				<td>
					<input type="checkbox" name="ingelogdblijven" value="1" id="ingelogdblijven" />
					Aangemeld blijven
				</td>
				<td colspan="2">
					<a href="#" style="color: #fff;" onclick="javascript: requestNewPasswordPopup();">Je wachtwoord vergeten? </a>
				</td>
			</tr>
		</table>
		<script>

			$("#wachtwoord").keyup(function(event)
			{
				if(event.keyCode == 13)
				{
					login();
				}
			});
			$("#Login").keyup(function(event)
			{
				if(event.keyCode == 13)
				{
					login();
				}
			});

			function requestNewPasswordPopup()
			{
				var url = 'factory/requestNewPassword.php';
				var email = $('#Login').val();
				if(email != '')
				{
					$.post(
						url, 
						{
							email: email
						}, 
						function(data){
							alert(data);
					});
				}
				else
				{
					$('#youtubeMovieHome').toggle(false);
					openPopup('/popup/wachtwoordvergeten.php', 'Wachtwoord vergeten', 400, 300);
				}
			}
		</script>
		<?php
	}
	else
	{
		?>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tbody>
				<tr>
					<td rowspan="3" width="350">
						<img src="images/logo_prijsgezocht2.png" width="321" align="top" height="71" />
					</td>
					<td rowspan="3" width="150" align="left">
						<?php
						if(isset($_SESSION['webshop']['Name']))
						{
							echo "<b>".$_SESSION['webshop']['Name']."</b>";
							echo " <a href=\"#\" style=\"color:#fff;\" onclick=\"javascript: $.post('factory/selectWebshop.php',{webshopID: ''},function(data){window.location = window.location;});return false;\"><small>Terug naar overzicht</small></a>";
						}
						?>
					</td>
					<td width="13%">
						&nbsp;
					</td>
					<td colspan="2">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td><?=$_SESSION['login']['Email'];?></td>
					<td width="12%">
						<input type="button" value=" Mijn account " onclick="return false;" />
					</td>
					<td width="10%">
						<input type="button" value=" Uitloggen " onclick="javascript: logout(); return false;" />
					</td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td colspan="2">&nbsp;</td>
				</tr>
			</tbody>
		</table>
		<?php
	}
	?>
    </div>
    <div class="main_menu">
    	<?php
    	include_once "menu.php";
    	?>
    </div>
    <div class="midden_container">